import ttf2woof from 'ttf2woff2-no-gyp';

class TTFFontToWOFFFontConverter {
    constructor() {}

    public convert(fontBuffer: Buffer, options?: { metadate: any }) {
        if (!fontBuffer) {
            return;
        }

        return Buffer.from(ttf2woof(fontBuffer, options)?.buffer);
    }
}

const DefaultTTFFontToWOFFFontConverter = new TTFFontToWOFFFontConverter();

export { TTFFontToWOFFFontConverter, DefaultTTFFontToWOFFFontConverter };
